home *** CD-ROM | disk | FTP | other *** search
- ## clip_images.tg
- # Read image files (oldest first) from SRC_DIR into IN_FILE
- # Then, crop the image and build a new OUT_NAME
- # Write the cropped image in OUT_NAME to disk
- # Finally, delete the original IN_FILE
-
- # clip_images
- {
- -name clip_images
- -start
-
- ###
- # setup source, destination and temp names
- # You can either uncomment these lines or set these values in your
- # computer environment.
- -action -set SRC_DIR=c:\pitfight
- -action -set IN_NAME=
- -action -set OUT_NAME=
-
- # set up an error handler for file operations
- -action -onerror file_operation_fail
-
- # supply input mask and output variable name
- -action -set OP=getFile
- -action -print trying to GET oldest file first
- -action -getFile -oldest "%SRC_DIR%\*.bmp" IN_NAME
-
- # read the dib
- -action -set OP=dibRead
- -action -print Reading DIB %IN_NAME%
- -action -img dibRead handle %IN_NAME%
-
- # crop the dib
- -action -set OP=dibCrop
- -action -print Cropping DIB %IN_NAME%
- -action -img dibCrop handle 640 480
-
- # create new output name in OUT_NAME
- -action -str SplitPath %IN_NAME% drive path fname ext
- -action -str MakePath OUT_NAME %drive% %path% %fname% "dib"
-
- # write the BMP file
- -action -set OP=dibWriteBMP
- -action -print Writing BMP %OUT_NAME%
- -action -img dibWriteBMP handle %OUT_NAME%
-
- # free memory
- -action -set OP=dibRelease
- -action -print Freeing DIB memory
- -action -img dibRelease handle
-
- # delete the input file
- -action -set OP=delete
- -action -print Delete %IN_NAME%
- -action -delete %IN_NAME%
-
- # done!
- -action -print done!
- -action -inc 0 0 0 1
- }
-
- # file operation failed
- {
- -name file_operation_fail
- -action -print file operation %OP% failed
- -action -print will try later
- -action -return break
- }
-
-